# 打印 1-10 的整数

# num = 1
# while num <= 10:
#     print(num)
#     num = num + 1


# 计算 1-100 的和
# sum 变量用于表示计算的和
# sum = 0
# num = 1
# while num <= 100:
#     sum += num
#     num += 1
#
# print(f'sum = {sum}')


# 计算 5 的阶乘
# result = 1
# num = 1
# while num <= 5:
#     result *= num
#     num += 1
# print(f'result = {result}')


# 求 1! + 2! + 3! + 4! + 5!
num = 1
# sum 表示最终的加和结果
sum = 0
while num <= 5:
    # 先计算出当前 num! 是多少, 往 sum 上进行累加.
    factorResult = 1
    i = 1
    while i <= num:
        factorResult *= i
        i += 1
    sum += factorResult
    num += 1

print(f'sum = {sum}')

